package com.ruike.alisurface.https;

import com.ruike.alisurface.BuildConfig;
import com.ruike.alisurface.Constant;
import com.ruike.alisurface.utils.ShareKey;
import com.voodoo.lib_http.ApiListener;
import com.voodoo.lib_http.ApiTools;
import com.voodoo.lib_utils.SharedUtils;

import java.util.HashMap;

/**
 * Author: voodoo
 * CreateDate: 2020-03-26 026 下午 01:59
 * Description:
 */
public class AppUpdateHttp {

    private static String url = Constant.HttpUrl.BASE_URL_IP;

    public static void tellServiceAppVersionInfo(ApiListener apiListener) {
        HashMap params = new HashMap();
        params.put("mchid", SharedUtils.getInstance().getString(ShareKey.MCH_ID));
        params.put("AppProject_Id", Constant.APP_TYPE);
        params.put("app_Version", BuildConfig.VERSION_NAME);
        params.put("packageName", BuildConfig.APPLICATION_ID);

        ApiTools.getInstance().post(url + "AppUpdate/TellService_AppVersion_Info", params, apiListener);
    }

    /**
     * 获取主程序的下载地址
     *
     * @param appProjectId 项目ID
     * @param baseView     回调
     */
    public static void getAppVersion(String appProjectId, ApiListener baseView) {
        HashMap params = new HashMap();
        params.put("AppProject_Id", appProjectId);
        ApiTools.getInstance().get(url + "AppUpdate/Get_AppVersion", params, baseView);
    }

    /**
     * 安卓告知服务器广告更换完成
     */
    public static void getConfirm_ApplyAd(String ad_id, ApiListener baseView) {
        String id1 = SharedUtils.getInstance().getString(ShareKey.MCH_ID);
        String Confirm_ApplyAd = url + "/A_AdApi/Confirm_ApplyAd";
        HashMap params = new HashMap();
        params.put("Mchid", id1);
        params.put("ad_id", ad_id);
        ApiTools.getInstance().post(Confirm_ApplyAd, params, baseView);

    }
}
